#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
(progn ;;init forms
  (ros:ensure-asdf)
  #+quicklisp(ql:quickload '(:lilu-roswell
                             :lilu-debugger)
                           :silent t))

(defpackage :ros.script.lilu-eval.3841829401
  (:use :cl))
(in-package :ros.script.lilu-eval.3841829401)

(opts:define-opts
  #.lilu-roswell:*default-help-option*
  #.lilu-roswell:*default-debugger-option*)

(defun main (&rest argv)
  (lilu-roswell:init)
  (multiple-value-bind (options free-args)
      (lilu-roswell:parse-options argv
                                  :free-args-p t :min-free-args 1 :max-free-args 1)
    (declare (ignorable free-args))
    (lilu-roswell:options-check-for-help options
                                         :prefix nil
                                         :suffix nil
                                         :usage-of "lilu-script.ros"
                                         :args     "FILE ...")
    (lilu-debugger:with-debugger
        ((lilu-roswell:options-get-value options :debugger))
      (with-open-file (stream (car free-args))
        ;; remove shebang
        (let ((first-char (read-char stream))
              (second-char (read-char stream)))
          (cond
            ((and (char= first-char #\#) (char= second-char #\!))
             (read-line stream))
            (t (unread-char second-char stream)
               (unread-char first-char stream))))
        (loop for sexp = (read stream nil)
              while sexp
              do
                 (format t "~A => ~A~%" sexp (eval sexp)))))))

;;; vim: set ft=lisp lisp:
